<template>
	<view class='search'>
		<Lines />

		<view class='search-item'>
			<view class='search-title'>
				<view class='f-color'>最近搜索</view>
				<view class='iconfont icon-iconset0213'></view>
			</view>
			
			<view>
				<view class="search-name f-color">四件套</view>
				<view class="search-name f-color">面膜</view>
			</view>
	
		</view>

		<view class='search-item'>
			<view class='search-title'>
				<view class='f-color'>热门搜索</view>
			</view>
			<view>
				<view class='search-name f-color'>四件套</view>
				<view class='search-name f-color'>面膜</view>
			</view>
		</view>

	</view>
</template>

<script>
	import Lines from '@/components/common/Lines.vue'
	export default {
		components: {
			Lines
		},
		data() {
			return {
              //输入的关键词
              keyword:'',
              //搜索过的词记录
              searchData:[]
			}
		},
		methods: {
			//判断关键词是否为空和跳转页面的
			search(){
				if( this.keyword ==="" ){
					return uni.showToast({
						title:"关键词不能为空",
						icon:"none"
					})
				}else{
					// this.toSearchList(this.keyword);
				uni.navigateTo({
					url:'../search-list/search-list'
				})
				}
				// uni.hideKeyboard();
				// this.addSearch();
			},
		},
		
	//监听input输入内容
		onNavigationBarSearchInputChanged(e){
		     this.keyword = e.text;
			 // console.log(e);
		},
		
		//点击顶栏中的搜索按钮
		onNavigationBarButtonTap(){
			this.search();	
		},
		//监听软键盘的搜索按钮点击的
		onNavigationBarSearchInputConfirmed(){
			this.search();	
		},
	}
</script>

<style scoped>
.search-item{
	padding:20rpx;
}
.search-title{
	display: flex;
	justify-content: space-between;
}
.search-name{
	padding:4rpx 24rpx;
	background-color: #E1E1E1;
	display: inline-block;
	border-radius: 26rpx;
	margin:10rpx;
}
.search-end{
	text-align: center;
}
</style>